package t2;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Test {

	public static void main(String[] args) {
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		
		//获取日历
		Calendar cl = Calendar.getInstance();
		
		//获取当前日期
		Date now = cl.getTime();
		
		System.out.println("今天日期："+sdf.format(now));
		
		//获取day(号数)
		int day = cl.get(Calendar.DAY_OF_MONTH);
		
		for(int i=0;i<100;i++){
			//获取上周的日期
			cl.add(Calendar.DATE, -7);
			//获取修改后日历的日期
			int days = cl.get(Calendar.DAY_OF_MONTH);
			
			if(day==days){
				System.out.println(sdf.format(cl.getTime()));
			}
		}
		
	}
	
}
